Page 83 - 2629_Devagiri_C-8
P. 83
For example, to find the StudentID and FirstName where Age is 16 and FirstName is ‘Saanvi’, use To remove all records from a table, use the following command:
the following SELECT command: DELETE FROM Students;
In MySQL, you can exit from a database by using the EXIT or QUIT commands.
21 st #Critical Thinking
INTERDISCIPLINARY LEARNING Century #Information Literacy
Skills
Ask
AGENT In science class, you are recording daily temperatures to study climate change. Complete the given tasks:
OrangeAI
Create a Students table in the school database with the fields ID, Name, Class, Percentage and City.
Then, find the students who have a percentage above 80. (a) Create a table named WeatherData with fields: Date, City, Minimum and Maximum Temperature.
(b) Insert the temperature data for your city for a week.
Study (c) Write SQL queries to show all data when the maximum temperature is above 38°C.
(d) Write SQL queries to show all data when the minimum temperature is above 24°C.
UPDATING RECORDS IN A TABLE
To modify existing records in a table, use the UPDATE command. The basic syntax for the TECH
UPDATE command is as follows: T ¢ ANSI SQL standard: A set of rules defined by the American National Standards Institute
E to ensure consistency and compatibility of SQL across different database systems.
UPDATE table_name SET Column = value WHERE condition; R
M
To change the LastName and Address of the student having 32 as StudentID, use the following S ¢ PRIMARY KEY: A field used to uniquely identify records in a database.
command: ¢ FOREIGN KEY: A field in a table that refers to the primary key in another table.
REWIND RUN
« Data includes raw facts, figures or symbols that are yet to be processed into meaningful information.
« A database is defined as an organised collection of data that is stored and accessed electronically.
DELETING RECORDS FROM A TABLE « A relational database is a type of database that stores data in the form of tables.
The DELETE command is used to remove records from a table. It can be used in two ways: « A key is a column or a set of columns that helps us to identify records in a table.
« SQL enables us to store, retrieve and manipulate data in the form of tables.
Without WHERE clause With the WHERE clause
« A data type defines the sort of value that a column will contain.
A specific record can be removed using the WHERE clause with the DELETE command. If the « SQL operators are used to perform operations on values in an SQL query.
DELETE command is used without the WHERE clause, all the records in the table will be removed. « SQL constraints are used to define rules for table data.
Here is the command to remove the record of a student whose FirstName is Dev:
81
MySQL: My First Database

